<template>
  <div>
    <Header city="北京"/>
    <header-swiper :swiper="swiper"/>
    <home-nav-icon :list="iconList"/>
  </div>
</template>

<script>
import Header from './components/Header'
import HeaderSwiper from './components/Swiper'
import HomeNavIcon from './components/NavIcons'
import axios from 'axios'

export default {
  name: 'Home',
  components: {
    Header,
    HeaderSwiper,
    HomeNavIcon
  },
  data () {
    return {
      city: '',
      swiper: [],
      iconList: []
    }
  },
  methods: {
    getHomeData () {
      axios.get('/api/indexData.json').then(this.getHomeDataSucc)
    },
    getHomeDataSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.city = data.city
        this.swiper = data.swiperList
        this.iconList = data.iconList
      }
    }
  },
  mounted () {
    this.getHomeData()
  }
}
</script>

<style>

</style>
